<?php
session_start();

	$_SESSION['hallpass'] = true;
include ".\DBConnection.php";



$connection = new Connection(); //connect to the DB

$email = $_GET['email'];

$query = "SELECT w_email
        FROM workertrack.worker
        WHERE w_email = '$email'
        UNION
        SELECT w_email
        FROM workertrack.temp_user 
        WHERE w_email = '$email'
        UNION
        SELECT emp_email
        FROM workertrack.employer 
        WHERE emp_email = '$email';"; 

$result = $connection->execute_query($query);	//result gets the info from the DB


if(mysql_num_rows($result)<1) //user does not exist
{
	echo "OK";
	//header('Location: index.php');
	//echo "name is available";
    //die();
}
else
{
	echo "Error";	
}

//header('Location: login_form.php');	

//echo "name is not available";





$connection->close_connection();

$_SESSION['hallpass'] = false;

?>
